﻿using Microsoft.Extensions.Configuration;
using PLC.Core.Entities;
using System.Data.Entity;
using YWM;
using YWM.EntityFramework;
using YWM.Repositories;

namespace PLC.EntityFramework
{
    [AutoRepositoryTypes(
    typeof(IRepository<>),
    typeof(IRepository<,>),
    typeof(PLCRepository<>),
    typeof(PLCRepository<,>)
    )]
    public class PLCDbContext : EFDbContext
    {
        public PLCDbContext() : base(GetConnectionString())
        {
        }

        private static string GetConnectionString()
        {
            return YApp.Configuration.GetConnectionString("PLCConnectionString");
        }

        public virtual DbSet<ActualData> ActualData { get; set; }
        public virtual DbSet<BaseMenu> BaseMenu { get; set; }
        public virtual DbSet<BaseUser> BaseUser { get; set; }
        public virtual DbSet<BaseUserPermission> BaseUserPermission { get; set; }
        public virtual DbSet<Device> Device { get; set; }
        public virtual DbSet<Group> Group { get; set; }
        public virtual DbSet<Recipe> Recipe { get; set; }
        public virtual DbSet<RecipeVariable> RecipeVariable { get; set; }
        public virtual DbSet<Station> Station { get; set; }
        public virtual DbSet<StationVariable> StationVariable { get; set; }
        public virtual DbSet<SysLog> SysLog { get; set; }
        public virtual DbSet<Variable> Variable { get; set; }
    }
}
